package demo.controller;


import javax.servlet.ServletContextEvent;

import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class DemoContextLoaderListener extends ContextLoaderListener {
    @Override
    public void contextInitialized(ServletContextEvent event) {
        super.contextInitialized(event);
        final WebApplicationContext wac =
            WebApplicationContextUtils.getRequiredWebApplicationContext(event.getServletContext());
        DemoSpringApplicationContextUtil.setApplicationContext(wac);
    }
}


















